<template>
	<a :href="'/admin/room/' + roomData.id">
		<div class="hote-room-container">
			<div class="hote-room-num">{{roomData.roomNum}}</div>
			<img :src="roomData.has_card == 1 ? '/images/home_in_card.png' : '/images/home_no_card.png'" alt="" class="hote-room-card">
			<div class="room-air-info">
				<div class="room-air-icon" :style="{backgroundColor: speed[roomData.speed].backColor}">{{speed[roomData.speed].label}}</div>
				<div class="room-air-temp">{{roomData.room_temp}}°C</div>
			</div>
			<div class="room-status-box">
				<img v-if="roomData.clean == 1" :src="status[2].image" alt="" class="room-status-image">
				<img v-if="roomData.dnd == 1" :src="status[3].image" alt="" class="room-status-image">
				<img v-if="roomData.ask == 1" :src="status[4].image" alt="" class="room-status-image">
				<img v-if="roomData.leave == 1" :src="status[6].image" alt="" class="room-status-image">
			</div>		
		</div>
	</a>
</template>

<style>
	.hote-room-container {
		width: 70px;
		height: 100px;
		position: relative;
		display: inline-block;
		background-color: #9f9f9f;
		border: 1px solid #909090;
		margin-right: 5px;
		margin-bottom: 5px;
	}
	.hote-room-num {
		margin-top: 5px;
		font-size: 14px;
		width: 70px;
		text-align: center;
	}
	.hote-room-card {
		position: absolute;
		top: 25px;
		left: 19px;
	}
	.room-air-info {
		position: absolute;
		top: 60px;
		line-height: 18px;
		margin: auto;
		width: 100%;
		display: flex;
		justify-content: center;
	}
	.room-air-icon {
		display: inline-block;
		color: #fff;
		font-size: 12px;
		width: 16px;
		text-align: center;
	}
	.room-air-temp {
		display: inline-block;
		font-size: 14px;
	}
	.room-status-box {
		position: absolute;
		top: 85px;
		height: 20px;
		width: 100%;
		padding-left: 10px;
	}
	.room-status-image {
		width: 10px;
		height: 10px;
	}
</style>

<script>
	import config from '../../config';

	const status = config.status || [];
	const speed  = config.speed || [];

	export default {
		data() {
			return {
				status,
				speed
			}
		},
		props: {
			roomData: {
				type: Object,
				default: {}
			}
		}
	}
</script>